$('document').ready(function(){		
    $.validator.addMethod("imageCheck", function (value, element) {
        return validateLogo();
    }, file_required); 
	$('#frmAdd').validate({
            errorClass      : 'error',
            errorElement	: 'span',
    		onfocusout		: false,
    		onkeyup			: false,
    		ignore			: 'input[type="text"]:hidden',
			rules:{
				name:{
					required:true,
					minlength:VL_NAME_MINLENGTH,
					maxlength:VL_NAME_MAXLENGTH
				},
                file:{
                    required: file_required,
                    imageCheck:file_format
                },				               
                sshort:{
                    required: true,
                    minlength: VL_SHORT_MINLENGTH,
                    maxlength: VL_SHORT_MAXLENGTH
                },
                description:{
                    required:true,
                    minlength:VL_CONTENT_MINLENGTH
                },
				
			},
			messages:{
				name:{
                    required : name_required,
                    minlength: name_minlength,
                    maxlength: name_maxlength
                },				
                short:{
                    required  : short_required,
                    minlength: short_minlength,
                    maxlength: short_maxlength
                },
                description:{
                    required:description_required,
                    minlength:description_minlength
                }
			},
			errorPlacement: function(error, element) {
			       error.insertAfter(element); // change this to place error message elsewhere
			}			
	});
});
function validateLogo() {
    strLogoPath = $('#file').val();
    if( strLogoPath.length > 0 ) {
        if(validateImage(strLogoPath)) {
            // image size 1MB
            if( validateImageSize(this,1) ){
                return true;
            }
        }
    }
    return false;
}
